package com.tengju.data.infrastructure.repository.clickhouse.convert;

import com.tengju.data.domain.model.clickhouse.OdsMarketIndex;
import com.tengju.data.domain.model.user.StarLevelEnum;
import com.tengju.data.domain.model.user.UserIdCode;
import com.tengju.data.infrastructure.persistence.mybatis.dataobject.OdsMarketIndexDO;

/**
 * @Author: 李大仙
 * @Date: 2021/4/7 10:04 下午
 */
public class OdsMarketIndexConvert {
    public static OdsMarketIndex convert(OdsMarketIndexDO odsMarketIndexDO) {
        if (odsMarketIndexDO == null){
            return null;
        }
        return OdsMarketIndex.builder()
                .idCode(new UserIdCode(odsMarketIndexDO.getIdCode()))
                .achievement(odsMarketIndexDO.getAchievement())
                .profit(odsMarketIndexDO.getProfit())
                .tengjuMobile(odsMarketIndexDO.getTengjuMobile())
                .tengjuNickname(odsMarketIndexDO.getTengjuNickname())
                .starLevel(StarLevelEnum.parseByStarLevel(odsMarketIndexDO.getStarLevel()))
                .abmMobile(odsMarketIndexDO.getAbmMobile())
                .abmNickname(odsMarketIndexDO.getAbmNickname())
                .build();
    }
}
